home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er Special 27
/
64er_Magazin_Sonderheft_27_19xx_Markt__Technik_de_Disk_2_of_2_Side_A.d64
/
giga grafik src
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
28KB
|
1,508 lines
10 ; ##############################
20 ; # #
30 ; # c 64 & giga-ass #
40 ; # #
50 ; # grafik-routinen, vers. 1.1 #
60 ; # #
70 ; # thomas dachsel, 06.01.1988 #
80 ; # #
90 ; ##############################
100 +$c000
101 ;********************************
102 ;* *
103 ;* einsprungtabelle: *
104 ;* ---------------- *
105 ;* diese tabelle enthaelt ein- *
106 ;* sprungpunkte fuer alle zur *
107 ;* verfuegung gestellten *
108 ;* grafikroutinen. *
109 ;* *
110 ;* routinen, die mehr parameter *
111 ;* benoetigen als cpu-register *
112 ;* vorhanden sind, haben vor *
113 ;* ihrem einsprungpunkt einen *
114 ;* sog. aktivierungsblock. *
115 ;* *
116 ;* die label r00, r03, r06, ... *
117 ;* dienen als hinweis auf die *
118 ;* relative position der *
119 ;* einsprungpunkte bzgl. *
120 ;* der basis-adresse. *
121 ;* *
122 ;********************************
200 r00 (NULL)page
210 r03 (NULL)design
220 r06 (NULL)off
230 r09 (NULL)inv
240 r0c (NULL)clear
250 r0f (NULL)color
260 r12 (NULL)setcol
270 r15 (NULL)cleardot
280 r18 (NULL)set
290 r1b (NULL)test
300 r1e (NULL)access
310 x0l then1
320 x0h then1
330 y0 then1
340 x1l then1
350 x1h then1
360 y1 then1
370 r27 (NULL)line
380 r2a (NULL)cline
390 fx0l then1
400 fx0h then1
410 fy0 then1
420 fx1l then1
430 fx1h then1
440 fy1 then1
450 r33 (NULL)frame
460 r36 (NULL)cframe
470 r39 (NULL)fill
480 tx then1
490 ty then1
500 expx then1
510 expy then1
520 case then1
530 r41 (NULL)text
540 rad then1
550 r45 (NULL)circle
560 r48 (NULL)ccircle
570 r4b (NULL)lines
580 r4e (NULL)clines
590 r51
600 ;--------------------------------
610 ; ab hier weitere eintrage
620 ;--------------------------------
1000 getram
1010 mid$#$7f;interrupts
1020 (NULL)$dc0d;aus
1030 mid$#$35;$a000 &
1040 (NULL)1;$e000 ram
1050 new
1060 getrom
1070 mid$#$37;$a000 &
1080 (NULL)1;$e000 rom
1090 new
1100 ;--------------------------------
1110 ; globale variablen
1120 ;--------------------------------
1130 tab(low=$14
1140 tab(high=$15
1150 tab(crp=$f9
1160 tab(hrp=$fb
1170 tab(hrb=$fd
1180 tab(hre=$fe
1190 tab(col=$ff
1200 ;--------------------------------
1210 ; grafik-seiten parameter
1220 ;--------------------------------
1230 pg1 fn$18,$78,$38,$38
1240 pg2 fn$04,$5c,$8c,$cc
1250 ;--------------------------------
1260 ; adress-tabellen
1270 ;--------------------------------
1280 tab1 fn0,$40,$80,$c0
1290 fn0,$40,$80,$c0
1300 fn0,$40,$80,$c0
1310 fn0,$40,$80,$c0
1320 fn0,$40,$80,$c0
1330 fn0,$40,$80,$c0,0
1340 tab2 fn0,1,2,3,5,6,7,8,$a,$b,$c,$d,$f
1350 fn$10,$11,$12,$14,$15,$16,$17,$19,$1a,$1b,$1c,$1e
1360 tab3 fn1,2,4,8,16,32,64,128
1370 ;--------------------------------
1380 ; 512 byte circle look-up tables
1390 ;--------------------------------
1400 lt1 fn$00,$01,$04,$09,$10,$19,$24,$31
1410 fn$40,$51,$64,$79,$90,$a9,$c4,$e1
1420 fn$00,$21,$44,$69,$90,$b9,$e4,$11
1430 fn$40,$71,$a4,$d9,$10,$49,$84,$c1
1440 fn$00,$41,$84,$c9,$10,$59,$a4,$f1
1450 fn$40,$91,$e4,$39,$90,$e9,$44,$a1
1460 fn$00,$61,$c4,$29,$90,$f9,$64,$d1
1470 fn$40,$b1,$24,$99,$10,$89,$04,$81
1480 fn$00,$81,$04,$89,$10,$99,$24,$b1
1490 fn$40,$d1,$64,$f9,$90,$29,$c4,$61
1500 fn$00,$a1,$44,$e9,$90,$39,$e4,$91
1510 fn$40,$f1,$a4,$59,$10,$c9,$84,$41
1520 fn$00,$c1,$84,$49,$10,$d9,$a4,$71
1530 fn$40,$11,$e4,$b9,$90,$69,$44,$21
1540 fn$00,$e1,$c4,$a9,$90,$79,$64,$51
1550 fn$40,$31,$24,$19,$10,$09,$04,$01
1560 fn$00,$01,$04,$09,$10,$19,$24,$31
1570 fn$40,$51,$64,$79,$90,$a9,$c4,$e1
1580 fn$00,$21,$44,$69,$90,$b9,$e4,$11
1590 fn$40,$71,$a4,$d9,$10,$49,$84,$c1
1600 fn$00,$41,$84,$c9,$10,$59,$a4,$f1
1610 fn$40,$91,$e4,$39,$90,$e9,$44,$a1
1620 fn$00,$61,$c4,$29,$90,$f9,$64,$d1
1630 fn$40,$b1,$24,$99,$10,$89,$04,$81
1640 fn$00,$81,$04,$89,$10,$99,$24,$b1
1650 fn$40,$d1,$64,$f9,$90,$29,$c4,$61
1660 fn$00,$a1,$44,$e9,$90,$39,$e4,$91
1670 fn$40,$f1,$a4,$59,$10,$c9,$84,$41
1680 fn$00,$c1,$84,$49,$10,$d9,$a4,$71
1690 fn$40,$11,$e4,$b9,$90,$69,$44,$21
1700 fn$00,$e1,$c4,$a9,$90,$79,$64,$51
1710 fn$40,$31,$24,$19,$10,$09,$04,$01
1720 lt2 then16
1730 fn1,1,1,1,1,1,1
1740 fn2,2,2,2,2,3,3,3,3
1750 fn4,4,4,4,5,5,5,5
1760 fn6,6,6,7,7,7,8,8,9,9,9
1770 fn$a,$a,$a,$b,$b,$c,$c
1780 fn$d,$d,$e,$e,$f,$f,$10
1790 fn$10,$11,$11,$12,$12,$13
1800 fn$13,$14,$14,$15,$15,$16
1810 fn$17,$17,$18,$19,$19,$1a
1820 fn$1a,$1b,$1c,$1c,$1d
1830 fn$1e,$1e,$1f,$20,$21
1840 fn$21,$22,$23,$24,$24
1850 fn$25,$26,$27,$27,$28
1860 fn$29,$2a,$2b,$2b,$2c
1870 fn$2d,$2e,$2f,$30,$31
1880 fn$31,$32,$33,$34,$35
1890 fn$36,$37,$38,$39,$3a
1900 fn$3b,$3c,$3d,$3e,$3f
1910 fn$40,$41,$42,$43,$44
1920 fn$45,$46,$47,$48,$49
1930 fn$4a,$4b,$4c,$4d,$4e
1940 fn$4f,$51,$52,$53,$54
1950 fn$55,$56,$57,$59,$5a
1960 fn$5b,$5c,$5d,$5f,$60
1970 fn$61,$62,$64,$65,$66
1980 fn$67,$69,$6a,$6b,$6c
1990 fn$6e,$6f,$70,$72,$73
2000 fn$74,$76,$77,$79,$7a
2010 fn$7b,$7d,$7e,$7f,$81
2020 fn$82,$84,$85,$87,$88
2030 fn$8a,$8b,$8d,$8e,$90
2040 fn$91,$93,$94,$96,$97
2050 fn$99,$9a,$9c,$9d,$9f
2060 fn$a0,$a2,$a4,$a5,$a7
2070 fn$a9,$aa,$ac,$ad,$af
2080 fn$b1,$b2,$b4,$b6,$b7
2090 fn$b9,$bb,$bd,$be,$c0
2100 fn$c2,$c4,$c5,$c7,$c9
2110 fn$cb,$cc,$ce,$d0,$d2
2120 fn$d4,$d5,$d7,$d9,$db
2130 fn$dd,$df,$e1,$e2,$e4
2140 fn$e6,$e8,$ea,$ec,$ee
2150 fn$f0,$f2,$f4,$f6,$f8
2160 fn$fa,$fc,$fe
3000 ;--------------------------------
3010 ;
3020 ; page
3030 ; ====
3040 ;
3050 ; x=0: grafikseite $2000
3060 ; farbspeicher $0400
3070 ;
3080 ; x=1: grafikseite $6000
3090 ; farbspeciher $5c00
3100 ;
3110 ; x=2: grafikseite $a000
3120 ; farbspeicher $8c00
3130 ;
3140 ; x=3: grafikseite $e000
3150 ; farbspeicher $cc00
3160 ;
3170 ; x>3: wird ignoriert
3180 ;
3190 ; der entsprechende 16 k - block
3200 ; wird angewaehlt durch setzen vom
3210 ; cia #1 port register a ($dd00).
3220 ; ausserdem werden die video-chip
3230 ; register und folgende zeiger
3240 ; gesetzt:
3250 ;
3260 ; bit-map: begin page -> hrb
3270 ; end page -> hre
3280 ; color: begin page -> col
3290 ;
3300 ;--------------------------------
3310 page tan#4
3320 (NULL)accept
3330 (NULL)
3340 accept mid$#$3b
3350 (NULL)$d011
3360 mid$#$c8
3370 (NULL)$d016
3380 mid$pg1,x
3390 (NULL)$d018
3400 (NULL)
3410 left$#3
3420 (NULL)$dd00
3430 pointers (NULL)
3440 (NULL)
3450 (NULL)
3460 (NULL)
3470 (NULL)
3480 val#$20
3490 (NULL)hrb
3500 val#$20
3510 (NULL)hre
3520 mid$pg2,x
3530 (NULL)col
3540 (NULL)
3550 ;--------------------------------
3560 ; design
3570 ; ======
3580 ; waehlt nur die aktuelle
3590 ; grafikseite aus (ermoeglicht
3600 ; "verdecktes" zeichnen).
3610 ;--------------------------------
3620 design tan#4
3630 (NULL)pointers
3640 (NULL)
3650 ;--------------------------------
3660 ; off: grafik-seite aus
3670 ;--------------------------------
3680 off mid$#$1b
3690 (NULL)$d011
3700 mid$#$15
3710 (NULL)$d018
3720 mid$#3
3730 (NULL)$dd00
3740 (NULL)
3750 ;--------------------------------
3760 ; inv: grafik-seite invertieren
3770 ;--------------------------------
3780 inv ram
3790 len#0
3800 (NULL)hrp
3810 peekhrb
3820 (NULL)hrp+1
3830 ilp mid$(hrp),y
3840 left$#$ff
3850 (NULL)(hrp),y
3860 (NULL)
3870 (NULL)ilp
3880 right$hrp+1
3890 (NULL)
3900 tanhre
3910 (NULL)ilp
3920 rom
3930 (NULL)
3940 ;--------------------------------
3950 ; clear: grafikseite loeschen
3960 ;--------------------------------
3970 clear mid$#0
3980 (NULL)hrp
3990 peekhrb
4000 (NULL)hrp+1
4010 (NULL)
4020 clp (NULL)(hrp),y
4030 (NULL)
4040 (NULL)clp
4050 right$hrp+1
4060 (NULL)
4070 tanhre
4080 (NULL)clp
4090 (NULL)
4100 ;--------------------------------
4110 ; color: fuellt gesamten farb-
4120 ; speicher mit inhalt des akkus
4130 ;
4140 ; high 4 bits : color of 1-bits
4150 ; low 4 bits : color of 0-bits
4160 ;--------------------------------
4170 color len#0
4180 (NULL)hrp
4190 peekcol
4200 (NULL)hrp+1
4210 peek#3
4220 colset (NULL)(hrp),y
4230 (NULL)
4240 (NULL)colset
4250 right$hrp+1
4260 (NULL)
4270 (NULL)colset
4280 (NULL)
4290 ;--------------------------------
4300 ; setcol: setzt farbe fuer 8 * 8
4310 ; bit-block
4320 ;
4330 ; a = zeile (0-24)
4340 ; x = spalte (0-39)
4350 ; y = farbe (0-15)
4360 ;--------------------------------
4370 setcol tan#40;x < 40 !
4380 (NULL)nocol
4390 str$#25;a < 25 !
4400 (NULL)nocol+1
4410 nocol (NULL)
4420 (NULL);a := a * 8
4430 (NULL)
4440 (NULL)
4450 (NULL)
4460 (NULL)hrp
4470 mid$#0
4480 (NULL)hrp+1
4490 (NULL)hrp
4500 (NULL)hrp+1
4510 (NULL)hrp;hrp =
4520 (NULL)hrp+1; a * 32
4530 (NULL)
4540 (NULL);hrp :=
4550 valhrp;hrp + a*8
4560 (NULL)hrp
4570 mid$#0;->
4580 valhrp+1;hrp = a*40
4590 (NULL)hrp+1
4600 (NULL);c = 0 !
4610 valhrp
4620 (NULL)hrp;hrp:=hrp+x
4630 mid$hrp+1
4640 valcol;add color
4650 (NULL)hrp+1;ram base
4660 peek#0;address
4670 mid$(hrp,x)
4680 asc#$f;isolate
4690 (NULL)(hrp,x);background
4700 (NULL);color
4710 (NULL)
4720 (NULL);high 4 bit
4730 (NULL);pen color
4740 (NULL)
4750 (NULL)(hrp,x);set new
4760 (NULL)(hrp,x);color
4770 (NULL)
5000 ;--------------------------------
5010 ;
5020 ; access single dot in bit-map
5030 ; ============================
5040 ;
5050 ; koordinaten werden gesetzt
5060 ; nach akku, x, y registern:
5070 ;
5080 ; x-achse: (a/x) y-achse: y
5090 ;
5100 ; die zulaessigen werte sind:
5110 ;
5120 ; 0 <= (x-achse) <= 319
5130 ; 0 <= (y-achse) <= 199
5140 ;
5150 ; andere werte werden ignoriert -
5160 ; die routine wird ohne neben-
5170 ; wirkung verlassen
5180 ;
5190 ; die auszufuehrende operation ist
5200 ; in $0002 kodiert:
5210 ;
5220 ; ($0002) = 0 => clear dot
5230 ; msb($0002) not set => set dot
5240 ; msb($0002) set => test dot
5250 ;
5260 ; "access" wird aufgerufen, falls
5270 ; $0002 schon gesetzt wurde.
5280 ;
5290 ; cleardot, set und test setzen
5300 ; $0002 vor aufruf von access.
5310 ;
5320 ; "test dot" c=0 : dot not set
5330 ; liefert: c=1 : dot set
5340 ;
5350 ;--------------------------------
5360 cleardot (NULL)
5370 mid$#0
5380 (NULL)cont
5390 set (NULL)
5400 mid$#1
5410 (NULL)cont
5420 test (NULL)
5430 mid$#$ff
5440 cont (NULL)2
5450 (NULL)
5460 ;
5470 ; *** coordinate check ***
5480 ;
5490 access atn#$c8
5500 (NULL)discard
5510 tan#1
5520 (NULL)acceptdot
5530 (NULL)discard
5540 str$#$40
5550 (NULL)acceptdot
5560 discard (NULL)
5570 ;
5580 ;*** compute bit-map pointer ***
5590 ;
5600 acceptdot (NULL)
5610 asc#$f8
5620 (NULL)hrp
5630 (NULL)
5640 (NULL)
5650 valhrb
5660 (NULL)hrp+1
5670 (NULL)
5680 (NULL)
5690 (NULL)
5700 (NULL)
5710 (NULL);0<= x <=25
5720 mid$tab1,x
5730 (NULL)
5740 valhrp
5750 (NULL)hrp
5760 mid$tab2,x
5770 valhrp+1
5780 (NULL)hrp+1
5790 (NULL)
5800 asc#7
5810 valhrp
5820 (NULL)hrp
5830 ram
5840 (NULL)
5850 asc#7
5860 left$#7;a := 7-a
5870 (NULL)
5880 mid$tab3,x;0 <=x<= 7
5890 ;********************************
5900 ;* *
5910 ;* accu now contains bit-mask . *
5920 ;* hrp points to bit-map memory *
5930 ;* to the byte containing the *
5940 ;* actual dot. *
5950 ;* *
5960 ;* operation subject to $0002 *
5970 ;* contents is now executed . *
5980 ;* *
5990 ;********************************
6000 len#0
6010 peek2
6020 (NULL)testdot
6030 (NULL)setdot
6040 asc(hrp),y
6050 left$(hrp),y
6060 (NULL)(hrp),y
6070 rom
6080 (NULL)
6090 setdot (NULL)(hrp),y
6100 (NULL)(hrp),y
6110 rom
6120 (NULL)
6130 testdot asc(hrp),y
6140 (NULL)notset
6150 rom
6160 (NULL)
6170 (NULL)
6180 notset rom
6190 (NULL)
6200 (NULL)
6210 ;--------------------------------
6220 ;
6230 ; draw/clear a line
6240 ; =================
6250 ;
6260 ; diese routine zeichnet bzw.
6270 ; loescht eine linie von den
6280 ; koordinaten (x0,y0) zu (x1,y1).
6290 ; line zeichnet, cline loescht
6300 ; die linie.
6310 ;
6320 ; y0 und y1 werden in einem byte
6330 ; gespeichert.
6340 ;
6350 ; x0 und x1 werden jeweils in
6360 ; zwei bytes gespeichert mit
6370 ;
6380 ; x0l fuer low byte
6390 ; von x0
6400 ; x0h fuer high byte
6410 ;
6420 ; x1l fuer low byte
6430 ; von x1
6440 ; x1h fuer high byte
6450 ;
6460 ; a, x, y werden ignoriert.
6470 ;
6480 ;
6490 ; die koordinaten werden nicht
6500 ; auf bereichsueberschreitung
6510 ; geprueft. deshalb koennen
6520 ; linien auch ueber den bild-
6530 ; schirmrand hinaus reichen.
6540 ;
6550 ; das hat jedoch keine
6560 ; schaedlichen auswirkungen, da
6570 ; schon "access" auf bereichs-
6580 ; ueberschreitung prueft.
6590 ;
6600 ; nach ausfuehrung von "line"
6610 ; ist (x0,y0) gleich (x1,y1).
6620 ; die koordinaten muessen daher
6630 ; bei jedem aufruf neu gesetzt
6640 ; werden.
6650 ;--------------------------------
6660 dx then1;internal
6670 dy then1;parameter
6680 diffxl then1;memory
6690 diffxh then1;area
6700 diffy then1
6710 dc then1
6720 dh then1
6730 dm then1
6740 dl then1
6750 qh then1
6760 qm then1
6770 ql then1
6780 delta_h then1
6790 delta_m then1
6800 delta_l then1
6810 line mid$#1
6820 (NULL)*+4
6830 cline mid$#0
6840 (NULL)2
6850 accessline
6860 ;********************************
6870 ;* *
6880 ;* 1. compute dx and dy *
6890 ;* -------------------- *
6900 ;* *
6910 ;* dx and dy are used to deter- *
6920 ;* mine in which direction the *
6930 ;* line is to be drawn. *
6940 ;* *
6950 ;* dx = -1 indicates *
6960 ;* x coord. decrements *
6970 ;* *
6980 ;* dx = 1 indicates *
6990 ;* x coord. increments *
7000 ;* *
7010 ;* dx = 0 indicates there is *
7020 ;* no x coord. change *
7030 ;* *
7040 ;* values of dy are analogous. *
7050 ;* *
7060 ;********************************
7070 peek#$ff;compute dx
7080 mid$x1h
7090 str$x0h
7100 (NULL)txl
7110 (NULL)dxp
7120 (NULL)dxn
7130 txl mid$x1l;test x low
7140 str$x0l
7150 (NULL)dxn
7160 (NULL)dxz
7170 dxp (NULL);dx = 1
7180 dxz (NULL);dx = 0
7190 dxn (NULL)dx;dx = -1
7200 ;================================
7210 peek#$ff;compute dy
7220 mid$y1
7230 str$y0
7240 (NULL)dyn
7250 (NULL)dyz
7260 (NULL);dy = 1
7270 dyz (NULL);dy = 0
7280 dyn (NULL)dy;dy = -1
7290 ;================================
7300 (NULL)equal;if dy = 0
7310 mid$dx;or dx = 0
7320 (NULL)equal;goto equal
7330 ;********************************
7340 ;* *
7350 ;* 2. compute x and y *
7360 ;* coordinate differences *
7370 ;* -------------------------- *
7380 ;* *
7390 ;* this is effected by normal *
7400 ;* subtraction and subsequent *
7410 ;* 2-complement formation, if *
7420 ;* result is negative. *
7430 ;* *
7440 ;********************************
7450 cdx mid$x1l;diff. x
7460 (NULL)
7470 (NULL)x0l
7480 (NULL)diffxl
7490 mid$x1h
7500 (NULL)x0h
7510 (NULL)diffxh
7520 mid$dx
7530 (NULL)cdy
7540 mid$diffxl;if dx= -1
7550 left$#$ff
7560 (NULL);compute
7570 val#1
7580 (NULL)diffxl;2-compl.
7590 mid$diffxh
7600 left$#$ff
7610 val#0
7620 (NULL)diffxh
7630 ;================================
7640 cdy mid$y1;diff. y
7650 (NULL)
7660 (NULL)y0
7670 (NULL)diffy
7680 mid$dy
7690 (NULL)incdiff;if dy = -1
7700 mid$diffy
7710 left$#$ff
7720 (NULL)
7730 val#1;2-compl.
7740 (NULL)diffy
7750 ;================================
7760 incdiff right$diffxl;increment
7770 (NULL)incdiffy;difference
7780 right$diffxh;by 1
7790 incdiffy right$diffy
7800 ;================================
7810 mid$diffxh
7820 (NULL)xway
7830 mid$diffxl
7840 str$diffy
7850 (NULL)xway
7860 (NULL)yway
7870 ;================================
7880 equal mid$x0l;"straight"
7890 peekx0h;lines are
7900 leny0;drawn here
7910 (NULL)access
7920 mid$y0
7930 str$y1
7940 (NULL)conteq
7950 mid$x0h
7960 str$x1h
7970 (NULL)conteq
7980 mid$x0l
7990 str$x1l
8000 (NULL)conteq
8010 (NULL)
8020 conteq mid$y0
8030 (NULL)
8040 valdy
8050 (NULL)y0
8060 mid$dx
8070 (NULL)equal
8080 (NULL)downxeq
8090 (NULL)
8100 valx0l
8110 (NULL)x0l
8120 mid$x0h
8130 val#0
8140 (NULL)x0h
8150 (NULL)equal
8160 downxeq chr$x0l
8170 mid$x0l
8180 str$#$ff
8190 (NULL)equal
8200 chr$x0h
8210 (NULL)equal
8220 ;********************************
8230 ;* *
8240 ;* 3. divide diff. x by diff. y *
8250 ;* ---------------------------- *
8260 ;* *
8270 ;* this is a 24/8 bit division. *
8280 ;* *
8290 ;* dc/dh/dm/dl is the dividend, *
8300 ;* diffy is the divisor, *
8310 ;* qh/qm/ql is the quotient. *
8320 ;* *
8330 ;********************************
8340 xway peek#0
8350 (NULL)dl
8360 mid$diffxl
8370 (NULL)dm
8380 mid$diffxh
8390 (NULL)dh
8400 (NULL)dc
8410 peek#24
8420 divloop mid$dh
8430 (NULL)
8440 (NULL)diffy
8450 (NULL)
8460 mid$dc
8470 (NULL)#0
8480 (NULL)rotleft
8490 (NULL)dh
8500 (NULL)dc
8510 (NULL)
8520 fn$24
8530 rotleft (NULL)
8540 (NULL)ql;rotate c
8550 (NULL)qm;left into
8560 (NULL)qh;quotient
8570 (NULL)dl
8580 (NULL)dm;rotate
8590 (NULL)dh;dividend
8600 (NULL)dc;left
8610 (NULL)
8620 (NULL)divloop
8630 ;================================
8640 mid$qh
8650 (NULL)delta_h
8660 mid$qm
8670 (NULL)delta_m
8680 mid$ql
8690 (NULL)delta_l
8700 ;================================
8710 xloop mid$x0h
8720 str$x1h
8730 (NULL)xcont
8740 mid$x0l
8750 str$x1l;if x0=x1
8760 (NULL)xcont;then exit
8770 (NULL)
8780 ;================================
8790 xcont mid$x0l
8800 peekx0h
8810 leny0
8820 (NULL)access
8830 mid$dx
8840 (NULL)xdown
8850 right$x0l
8860 (NULL)sety
8870 right$x0h
8880 (NULL)sety
8890 xdown chr$x0l
8900 mid$x0l
8910 str$#$ff
8920 (NULL)sety
8930 chr$x0h
8940 ;================================
8950 sety chr$delta_h
8960 (NULL)xloop
8970 mid$y0
8980 (NULL)
8990 valdy
9000 (NULL)y0
9010 (NULL)
9020 mid$delta_l
9030 valql
9040 (NULL)delta_l
9050 mid$delta_m
9060 valqm
9070 (NULL)delta_m
9080 mid$qh
9090 val#0
9100 (NULL)delta_h
9110 (NULL)xloop
9120 ;********************************
9130 ;* *
9140 ;* 4. divide diff. y by diff. x *
9150 ;* ---------------------------- *
9160 ;* *
9170 ;* this is a 24/8 bit division. *
9180 ;* *
9190 ;* dc/dh/dm/dl is the dividend, *
9200 ;* diffxl is the divisor, *
9210 ;* qh/qm/ql is the quotient. *
9220 ;* *
9230 ;********************************
9240 yway peek#0
9250 (NULL)dl
9260 mid$diffy
9270 (NULL)dm
9280 (NULL)dh
9290 (NULL)dc
9300 peek#24
9310 divyloop mid$dh
9320 (NULL)
9330 (NULL)diffxl
9340 (NULL)
9350 mid$dc
9360 (NULL)#0
9370 (NULL)rotlefty
9380 (NULL)dh
9390 (NULL)dc
9400 (NULL)
9410 fn$24
9420 rotlefty (NULL)
9430 (NULL)ql;rotate c
9440 (NULL)qm;left into
9450 (NULL)qh;quotient
9460 (NULL)dl
9470 (NULL)dm;rotate
9480 (NULL)dh;dividend
9490 (NULL)dc;left
9500 (NULL)
9510 (NULL)divyloop
9520 ;================================
9530 mid$qh
9540 (NULL)delta_h
9550 mid$qm
9560 (NULL)delta_m
9570 mid$ql
9580 (NULL)delta_l
9590 ;================================
9600 yloop mid$y0
9610 str$y1;if y0=y1
9620 (NULL)ycont;then exit
9630 (NULL)
9640 ;================================
9650 ycont mid$x0l
9660 peekx0h
9670 leny0
9680 (NULL)access
9690 mid$y0
9700 (NULL)
9710 valdy
9720 (NULL)y0
9730 setx chr$delta_h
9740 (NULL)yloop
9750 mid$dx
9760 (NULL)xdowny
9770 right$x0l
9780 (NULL)getdelta
9790 right$x0h
9800 (NULL)getdelta
9810 xdowny chr$x0l
9820 mid$x0l
9830 str$#$ff
9840 (NULL)getdelta
9850 chr$x0h
9860 ;================================
9870 getdelta (NULL)
9880 mid$delta_l
9890 valql
9900 (NULL)delta_l
9910 mid$delta_m
9920 valqm
9930 (NULL)delta_m
9940 mid$qh
9950 val#0
9960 (NULL)delta_h
9970 (NULL)yloop
10000 ;--------------------------------
10010 ;
10020 ; draw/clear a frame
10030 ; ==================
10040 ;
10050 ; frame zeichnet einen rahmen.
10060 ; cframe loescht diesen rahmen.
10070 ;
10080 ; (fx0,fy0) enthaelt die linke
10090 ; obere ecke and (fx1,fy1)
10100 ; die rechte untere ecke
10110 ; (oder umgekehrt).
10120 ;
10130 ;--------------------------------
10140 tab(px0l=x0l
10150 tab(px0h=x0h
10160 tab(px1l=x1l
10170 tab(px1h=x1h
10180 tab(py0=y0
10190 tab(py1=y1
10200 getlcclosexcl,xch,yc
10210 mid$xcl
10220 peekxch
10230 lenyc
10240 new
10250 getscclosexcl,xch,yc
10260 (NULL)xcl
10270 (NULL)xch
10280 (NULL)yc
10290 new
10300 getxf0closesxl,sxh,sy
10310 lcclosesxl,sxh,sy
10320 scclosepx0l,px0h,py0
10330 new
10340 getxf1closesxl,sxh,sy
10350 lcclosesxl,sxh,sy
10360 scclosepx1l,px1h,py1
10370 new
10380 frame mid$#1
10390 (NULL)*+4
10400 cframe mid$#0
10410 (NULL)2
10420 xf0closefx0l,fx0h,fy0
10430 xf1closefx1l,fx1h,fy0
10440 (NULL)accessline
10450 xf0closefx1l,fx1h,fy1
10460 (NULL)accessline
10470 xf0closefx0l,fx0h,fy0
10480 xf1closefx0l,fx0h,fy1
10490 (NULL)accessline
10500 xf0closefx1l,fx1h,fy1
10510 (NULL)accessline
10520 ;--------------------------------
10530 ;
10540 ; fill a frame
10550 ; ============
10560 ;
10570 ; fill fueltt einen bereich der
10580 ; grafikseite, der von einem
10590 ; rahmen beschraenkt ist.
10600 ;
10610 ; ohne begrenzung wird jeweils
10620 ; bis zum bildschirmrand auf-
10630 ; gefuellt.
10640 ;
10650 ; der punkt, an dem die fuell-
10660 ; operationen beginnt, wird mit
10670 ; a,x,y registern wie bei "set"
10680 ; festgelegt.
10690 ;
10700 ; ist dieser punkt bereits ge-
10710 ; setzt, stoppt fill sofort.
10720 ;
10730 ; warnung: in dieser version
10740 ; werden nur rechteckige rahmen
10750 ; vollstaendig ausgefuellt.
10760 ; in anderen faellen koennen
10770 ; mehrere "fills" notwendig sein.
10780 ;
10790 ;--------------------------------
10800 sxl then1
10810 sxh then1
10820 sy then1
10830 cxl then1
10840 cxh then1
10850 cy then1
10860 getinwcloseword
10870 right$word
10880 (NULL)end
10890 right$word+1
10900 end
10910 new
10920 getdcwcloseword
10930 chr$word
10940 mid$word
10950 str$#$ff
10960 (NULL)end
10970 chr$word+1
10980 end
10990 new
11000 fill scclosesxl,sxh,sy
11010 (NULL)test
11020 (NULL)begin
11030 (NULL)
11040 begin lcclosesxl,sxh,sy
11050 lineup scclosecxl,cxh,cy
11060 (NULL)test
11070 (NULL)setup
11080 (NULL)down
11090 setup lcclosecxl,cxh,cy
11100 (NULL)set
11110 mid$cxl
11120 (NULL)decrx;hit
11130 mid$cxh;left
11140 (NULL)contr;border ?
11150 decrx dcwclosecxl
11160 lcclosecxl,cxh,cy
11170 (NULL)test
11180 (NULL)setup
11190 contr mid$sxl;start
11200 peeksxh;x-coord.
11210 (NULL)cxl
11220 (NULL)cxh
11230 walkr mid$cxh
11240 (NULL)incrx
11250 mid$cxl;hit
11260 str$#$40;right
11270 (NULL)contup;border ?
11280 incrx inwclosecxl
11290 lcclosecxl,cxh,cy
11300 (NULL)test
11310 (NULL)contup
11320 lcclosecxl,cxh,cy
11330 (NULL)set
11340 (NULL)walkr
11350 contup mid$sxl
11360 peeksxh
11370 (NULL)cxl
11380 (NULL)cxh
11390 lcclosecxl,cxh,cy
11400 (NULL)
11410 atn#$ff
11420 (NULL)down
11430 (NULL)lineup
11440 down lcclosesxl,sxh,sy
11450 scclosecxl,cxh,cy
11460 bottom (NULL)
11470 atn#200
11480 (NULL)checkdown
11490 (NULL)
11500 checkdown (NULL)cy
11510 (NULL)test
11520 (NULL)setdown
11530 (NULL)
11540 setdown lcclosecxl,cxh,cy
11550 (NULL)set
11560 mid$cxl
11570 (NULL)decrxd;hit
11580 mid$cxh;left
11590 (NULL)contrd;border ?
11600 decrxd dcwclosecxl
11610 lcclosecxl,cxh,cy
11620 (NULL)test
11630 (NULL)setdown
11640 contrd mid$sxl;start
11650 peeksxh;x-coord.
11660 (NULL)cxl
11670 (NULL)cxh
11680 walkrd mid$cxh
11690 (NULL)incrxd
11700 mid$cxl;hit
11710 str$#$40;right
11720 (NULL)contdown;border ?
11730 incrxd inwclosecxl
11740 lcclosecxl,cxh,cy
11750 (NULL)test
11760 (NULL)contdown
11770 lcclosecxl,cxh,cy
11780 (NULL)set
11790 (NULL)walkrd
11800 contdown mid$sxl
11810 peeksxh
11820 (NULL)cxl
11830 (NULL)cxh
11840 lency
11850 (NULL)bottom
11860 ;--------------------------------
11870 ;
11880 ; text
11890 ; ====
11900 ;
11910 ; zeigt ascii text auf der
11920 ; aktuellen grafikseite an.
11930 ;
11940 ; die adresse des anzuzeigenden
11950 ; textes wird in die register
11960 ; (a/y) (low/high) geladen;
11970 ; die textfarbe ins x register.
11980 ; ist x>128, wird keine neue
11990 ; farbe gesetzt.
12000 ; die spalte/zeile, an der der
12010 ; erste buchstabe angezeigt wird,
12020 ; wird bestimmmt durch
12030 ;
12040 ; tx (spalte) : 0 <= tx <= 39
12050 ; ty (zeile) : 0 <= tx <= 24
12060 ;
12070 ; bei anderen werten stoppt
12080 ; " text " sofort.
12090 ;
12100 ; expx bestimmt die horizontale
12110 ; ausdehnung der buchstaben. es
12120 ; werden nur die beiden lsb's
12130 ; betrachtet. die werte 0,1,2,3
12140 ; bestimmen die ausdehnung in x-
12150 ; richtung.
12160 ; expy bestimmt die vertikale
12170 ; ausdehnung der buchstaben.
12180 ; die werte entsprechen denen von
12190 ; expx.
12200 ; case gibt an, welcher zeichen-
12210 ; satz verwendet wird
12220 ; (nur das lsb wird betrachtet):
12230 ;
12240 ; case=0 : upper case
12250 ;
12260 ; case=1 : lower case
12270 ;
12280 ; wird bei der anzeige des textes
12290 ; das zeilenende erreicht, haelt
12300 ; die routine, und der rest des
12310 ; textes wird ignoriert.
12320 ;
12330 ; das ende des textes wird durch
12340 ; ein null byte (hex 00) hinter
12350 ; dem letzten zeichen markiert.
12360 ;
12370 ;--------------------------------
12380 matbuf then8
12390 bxl then1
12400 bxh then1
12410 xxl then1
12420 xxh then1
12430 xy then1
12440 xxc then1
12450 xyc then1
12460 textcol then1
12470 ;================================
12480 text (NULL)readchar+1
12490 (NULL)readchar+2
12500 (NULL)textcol
12510 ;================================
12520 textloop mid$tx;enough
12530 str$#40;room left?
12540 (NULL)terminate
12550 mid$ty
12560 str$#25
12570 (NULL)terminate
12580 readchar mid$$ffff;text adr.
12590 (NULL)conttext
12600 terminate mid$#0;reset
12610 (NULL)2;loc. 2 !
12620 (NULL)
12630 ;================================
12640 conttext inwclosereadchar+1
12650 lentextcol
12660 (NULL)colorchar
12670 str$#" "
12680 (NULL)convchar+1
12690 (NULL)nextcol
12700 colorchar (NULL)
12710 mid$#0
12720 (NULL)low
12730 (NULL)high
12740 tcl lentextcol
12750 mid$tx
12760 (NULL)
12770 vallow;x offset
12780 (NULL)
12790 mid$ty
12800 (NULL)
12810 valhigh;y offset
12820 (NULL)setcol
12830 mid$low
12840 str$expx
12850 (NULL)tcc
12860 right$low
12870 (NULL)tcl
12880 tcc mid$high
12890 str$expy
12900 (NULL)convchar
12910 mid$#0
12920 (NULL)low
12930 right$high
12940 (NULL)tcl
12950 ;================================
12960 convchar (NULL)
12970 str$#$40
12980 (NULL)tl
12990 str$#$60;convert
13000 (NULL)cv1;ascii
13010 str$#$80;to
13020 (NULL)cv2;screen
13030 str$#$c0;code
13040 (NULL)cv1
13050 cv2 (NULL)
13060 (NULL)#$40
13070 cv1 (NULL)
13080 (NULL)#$40
13090 tl (NULL)crp;init
13100 mid$#0;char-rom
13110 (NULL)crp+1;pointer
13120 peek#3
13130 mult8 (NULL)crp;multiply
13140 (NULL)crp+1;"crp" by 8
13150 (NULL)
13160 (NULL)mult8
13170 mid$case;add base
13180 asc#1;address
13190 (NULL)
13200 (NULL);character
13210 (NULL);matrix is
13220 val#$d0;rom area
13230 valcrp+1;at $d000!
13240 (NULL)crp+1
13250 ;********************************
13260 ;* *
13270 ;* crp now contains pointer to *
13280 ;* the actual 8*8 - bit matrix *
13290 ;* of the character to be dis- *
13300 ;* played. these 8 bytes are *
13310 ;* now copied into " matbuf ". *
13320 ;* *
13330 ;********************************
13340 (NULL);irq off,
13350 mid$#$33;character
13360 (NULL)1;rom on !
13370 len#7
13380 matcopy mid$(crp),y
13390 (NULL)matbuf,y
13400 (NULL)
13410 (NULL)matcopy
13420 mid$#$37;character
13430 (NULL)1;rom off,
13440 (NULL);irq on .
13450 ;********************************
13460 ;* *
13470 ;* column and line values are *
13480 ;* transformed into x/y coor- *
13490 ;* dinates for accessing dots *
13500 ;* *
13510 ;********************************
13520 mid$tx
13530 (NULL)
13540 (NULL)
13550 (NULL)
13560 (NULL)bxl
13570 mid$#0
13580 val#0
13590 (NULL)bxh
13600 mid$ty
13610 (NULL)
13620 (NULL)
13630 (NULL)
13640 (NULL)xy
13650 ;********************************
13660 ;* *
13670 ;* one letter is printed into *
13680 ;* the bit-map by isolating *
13690 ;* each dot of its matrix ; *
13700 ;* *
13710 ;* testing if it is set by *
13720 ;* anding with the powers of 2 *
13730 ;* (in tab3); isolating the *
13740 ;* zero flag after this opera- *
13750 ;* tion that indicates the *
13760 ;* equality, inverting it, *
13770 ;* *
13780 ;* and finally storing it as *
13790 ;* the clear/set parameter of *
13800 ;* the " access " routine. *
13810 ;* *
13820 ;********************************
13830 mid$expy
13840 asc#3
13850 (NULL)xyc
13860 mid$#0
13870 (NULL)high
13880 linebegin mid$#7
13890 (NULL)low
13900 mid$bxl
13910 (NULL)xxl
13920 mid$bxh
13930 (NULL)xxh
13940 setloop lenhigh
13950 peeklow
13960 mid$matbuf,y
13970 asctab3,x
13980 (NULL)
13990 (NULL);isolate
14000 asc#2;zero flag
14010 left$#2;& invert
14020 (NULL)2;-> clear
14030 mid$expx; or set
14040 asc#3
14050 (NULL)xxc
14060 multiple lcclosexxl,xxh,xy
14070 (NULL)access
14080 inwclosexxl
14090 chr$xxc;expand x
14100 (NULL)multiple
14110 chr$low
14120 (NULL)setloop
14130 right$xy
14140 chr$xyc;expand y
14150 (NULL)linebegin
14160 right$high
14170 mid$expy
14180 asc#3
14190 (NULL)xyc
14200 mid$high
14210 str$#print#
14220 (NULL)linebegin
14230 nextcol peektx
14240 (NULL)
14250 (NULL)
38836 (NULL)
14270 valexpx
14280 (NULL)tx
14290 (NULL)textloop
15000 ;--------------------------------
15010 ;
15020 ; circle / ccircle
15030 ; ================
15040 ;
15050 ; zeichnet/loescht einen kreis.
15060 ; der mittelpunkt des kreises
15070 ; steht in den a,x,y registern.
15080 ;
15090 ; der radius steht in "rad".
15100 ;
15110 ;--------------------------------
15120 mxl then1
15130 mxh then1
15140 my then1
15150 c1 then1
15160 c2 then1
15170 c3 then1
15180 c4 then1
15190 tab(cdot=access
15200 getcs
15210 mid$low
15220 peekhigh
15230 (NULL)cdot
15240 new
15250 circle (NULL)
15260 mid$#1
15270 (NULL)*+5
15280 ccircle (NULL)
15290 mid$#0
15300 (NULL)2
15310 (NULL)
15320 scclosemxl,mxh,my
15330 right$rad
15340 peekrad
15350 tan#2
15360 (NULL)readlt
15370 (NULL)
15380 readlt mid$lt1,x
15390 (NULL)c1
15400 mid$lt2,x
15410 (NULL)c2
15420 (NULL)
15430 (NULL)c4
15440 lenrad
15450 (NULL)$b3a2
15460 (NULL)$bc0c
15470 len#$4b
15480 (NULL)$b3a2
15490 (NULL)$ba2b
15500 (NULL)$bafe
15510 (NULL)$bafe
15520 (NULL)$bc9b
15530 mid$#0
15540 (NULL)c3
15550 cloop peekc3
15560 (NULL)
15570 mid$c1
15580 (NULL)lt1,x
15590 (NULL)low
15600 mid$c2
15610 (NULL)lt2,x
15620 (NULL)high
15630 peekc4
15640 mid$lt2,x
15650 str$high
15660 (NULL)cl1
15670 (NULL)cl3
15680 (NULL)cl2
15690 cl1 mid$lt1,x
15700 str$low
15710 (NULL)cl3
15720 cl2 chr$c4
15730 cl3 (NULL)
15740 mid$c4
15750 valmy
15760 (NULL)
15770 (NULL)
15780 mid$mxl
15790 valc3
15800 (NULL)low
15810 mid$mxh
15820 val#0
15830 (NULL)high
15840 cs
15850 (NULL)
15860 mid$my
15870 (NULL)c4
15880 (NULL)
15890 cs
15900 (NULL)
15910 mid$my
15920 valc4
15930 (NULL)
15940 (NULL)
15950 mid$mxl
15960 (NULL)c3
15970 (NULL)low
15980 mid$mxh
15990 (NULL)#0
16000 (NULL)high
16010 cs
16020 (NULL)
16030 mid$my
16040 (NULL)c4
16050 (NULL)
16060 cs
16070 (NULL)
16080 mid$mxl
16090 valc4
16100 (NULL)low
16110 mid$mxh
16120 val#0
16130 (NULL)high
16140 (NULL)
16150 mid$my
16160 valc3
16170 (NULL)
16180 cs
16190 (NULL)
16200 mid$my
16210 (NULL)c3
16220 (NULL)
16230 cs
16240 (NULL)
16250 mid$mxl
16260 (NULL)c4
16270 (NULL)low
16280 mid$mxh
16290 (NULL)#0
16300 (NULL)high
16310 (NULL)
16320 mid$my
16330 valc3
16340 (NULL)
16350 cs
16360 (NULL)
16370 mid$my
16380 (NULL)c3
16390 (NULL)
16400 cs
16410 (NULL)
16420 mid$c3
16430 val#1
16440 (NULL)c3
16450 str$$65
16460 (NULL)cterm
16470 (NULL)cloop
16480 cterm (NULL)
16490 ;--------------------------------
16500 ;
16510 ; draw lines / clear lines
16520 ; ======(NULL)=======(NULL)=========
16530 ;
16540 ; diese routinen erhalten einen
16550 ; zeiger in (a/y) auf eine
16560 ; koordinatentabelle.
16570 ;
16580 ; die eintraege dieser tabelle
16590 ; werden als die koordinaten
16600 ; von endpunkten von zusammen-
16610 ; haengenden linien interpretiert.
16620 ; von einem punkt zum naechsten
16630 ; wird jeweils eine linie
16640 ; gezeichnet / geloescht.
16650 ; das ende der tabelle wird mar-
16660 ; kiert durch eine x koordinate
16670 ; >= $8000.
16680 ;--------------------------------
16690 getctfclosepar
16700 ;coordinate transfer
16710 mid$(low),y
16720 (NULL)par
16730 (NULL)
16740 new
16750 lines peek#1
16760 (NULL)*+4
16770 clines peek#0
16780 (NULL)2
16790 (NULL)low
16800 (NULL)high
16810 loop len#4;second dot
16820 mid$(low),y;table end?
16830 (NULL)contlines
16840 (NULL)
16850 contlines len#0
16860 ctfclosex0l
16870 ctfclosex0h
16880 ctfclosey0
16890 ctfclosex1l
16900 ctfclosex1h
16910 ctfclosey1
16920 mid$low
16930 (NULL)
16940 val#3
16950 (NULL)low
16960 mid$high
16970 val#0
16980 (NULL)high
16990 (NULL)accessline
17000 (NULL)loop
17010 ;--------------------------------
17020 ;
17030 ; *** ende des quelltextes ***
17040 ;
17050 ; ab hier platz fuer zusaetzliche
17060 ; grafik-routinen!
17070 ;
17080 ;--------------------------------